#!/usr/bin/env bash

__is3_foe_dir_stl0_FLOW() {

    if ! command -v is3_foe_dir_stl0 >/dev/null; then
        echo "TYPE_ERROR : is3_foe_dir_stl0" >&2
        return 1
    fi

    filename=${ST_RC_D_PATH}/.d/.arb/stl0.arb/is3_foe_dir_stl0.ram/.grot/_tst/_flow_tst.sh.v1

    local PW=$(pwd)
    local idir="$(dirname ${filename})"

    local ARGS0="$1"
    local ARGS1="$2"
    local ARGS2="$3"
    local ARGS3="$4"

    local NARGS=$#

    cd "${idir}" || {
        echo "${idir} not dir" >&2
        return 1
    }

    #?----------------------------------------------------
    #?-------------------------------------

    # : >res

    # rm -rf ${HOME}/.foe.bac
    # cp -r ${HOME}/.foe/init/. ${HOME}/.foe.bac
    # : >${HOME}/.foe.bac/1.file
    # echo "rbdbgf" >${HOME}/.foe.bac/init
    # mkdir ${HOME}/.foe.bac/dir
    # echo "yuoy" >${HOME}/.foe.bac/dir/2.file

    rm -rf ${HOME}/.foe.bac
    cp -r ${HOME}/.foe/init/. ${HOME}/.foe.bac

    echo -e "${HLIGHT}--- is3_foe_dir_stl0 ${HOME}/.foe.bac ---${NORMAL}" #start files
    is3_foe_dir_stl0 ${HOME}/.foe.bac
    _ret2e is3_foe_dir_stl0 ${HOME}/.foe.bac

    echo -e "${HLIGHT}--- is3_foe_dir_stl0 ${HOME}/x/.foe.bac ---${NORMAL}" #start files
    is3_foe_dir_stl0 ${HOME}/x/.foe.bac
    _ret2e is3_foe_dir_stl0 ${HOME}/x/.foe.bac

    echo -e "${HLIGHT}--- cd ${HOME}/.foe.bac ---${NORMAL}" #start files
    cd ${HOME}/.foe.bac || {
        _st_exit "FAIL: cd ${HOME}/.foe.bac"
        return 1
    }

    echo -e "${HLIGHT}--- is3_foe_dir_stl0 ---${NORMAL}" #start files
    is3_foe_dir_stl0
    _ret2e is3_foe_dir_stl0

    echo -e "${HLIGHT}--- is3_foe_dir_stl0 dfv ---${NORMAL}" #start files
    is3_foe_dir_stl0 dfv
    _ret2e is3_foe_dir_stl0 dfv

    echo -e "${HLIGHT}--- is3_foe_dir_stl0 ${HOME}/.foe ---${NORMAL}" #start files
    is3_foe_dir_stl0 ${HOME}/.foe
    _ret2e is3_foe_dir_stl0 ${HOME}/.foe

    #?-------------------------------------
    #?----------------------------------------------------

    cd "${PW}" || {
        echo "${PW} not dir" >&2
        return 1
    }

}

__is3_foe_dir_stl0_FLOW "$@"
